package com.jingtai.shop.controller.goods;

import com.jingtai.common.template.ResultMapInfo;
import com.jingtai.shop.common.template.ShopBaseController;
import com.jingtai.shop.service.goods.UserStoreService;
import com.jingtai.shop.webfacade.bo.store.StoreDetailsBO;
import com.jingtai.shop.webfacade.vo.collect.store.StoreDetailsVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@Api(tags = "商城-店铺")
@RestController
@RequestMapping("/shop/store")
@CrossOrigin(origins = "*")
public class UserStoreController extends ShopBaseController {


    @Resource
    private UserStoreService storeService;

    /**
     * 查看店铺详情
     */
    @ApiOperation(value = "查看店铺详情")
    @PostMapping("/showStoreDetails")
    public Map<String, Object> showStoreDetails(@RequestBody StoreDetailsBO bo) {
        bo.validate();
        Long userId = 0L;
        try {
            userId = getUserId();
        }catch (Exception e){

        }

        StoreDetailsVO storeDetailsVO = storeService.showStoreDetails(bo.getStoreId(), bo.getGoodsTitle(),userId);
        return returnResultMap(ResultMapInfo.GETSUCCESS, storeDetailsVO);
    }
}
